package com.chinasoft.book.service.impl;

import com.chinasoft.book.mapper.BookMapper;
import com.chinasoft.book.service.BookService;
import lombok.AllArgsConstructor;
import lombok.Setter;
import lombok.ToString;

/**
 * 业务层的实现
 */
@AllArgsConstructor   // 生成 全参构造法
@ToString   // 生成 toString 方法
public class BookServiceImpl2 implements BookService {
    BookMapper bookMapper;
    String name;
    Integer age;

    // 全参 构造法
   /* public BookServiceImpl2(BookMapper bookMapper, String name, Integer age) {
        this.bookMapper = bookMapper;
        this.name = name;
        this.age = age;
    }*/

    @Override
    public void queryBook() {
        System.out.println("book service  version 2");
        System.out.println("业务层 执行代码");
        System.out.println(this.name);
        // 调用 dao层代码（持久层代码）
        String result = bookMapper.selectById(100);
        System.out.println(result);
        System.out.println(this);
    }
}
